
import java.util.Enumeration;
import javax.swing.tree.DefaultMutableTreeNode;


public class DefMutTreeNode{
	
	private DefaultMutableTreeNode person, employee, customer, us_customer;
		
	public DefMutTreeNode() {			
		
		employee = new DefaultMutableTreeNode("employee");
		employee.add(new DefaultMutableTreeNode("sales_rep"));
		employee.add(new DefaultMutableTreeNode("engineer"));			
		
		us_customer = new DefaultMutableTreeNode("us_customer");		
		us_customer.add(new DefaultMutableTreeNode("local_customer"));
		us_customer.add(new DefaultMutableTreeNode("regional_customer"));
		
		customer = new DefaultMutableTreeNode("customer");
		customer.add(new DefaultMutableTreeNode("non_us_customer"));
		customer.add(us_customer);
		
		person = new DefaultMutableTreeNode("person");
		person.add(employee);
		person.add(customer);
		

		
		
	}
	
	public String printBreadth() {
		String breadthFirstEnumeration = "";
		Enumeration<?> bf = person.breadthFirstEnumeration();
		while(bf.hasMoreElements()){
			breadthFirstEnumeration += bf.nextElement().toString() + "\n";			
		}
		
		return breadthFirstEnumeration;	
	}
	
	public String printPreOrder() {
		String preOrderEnumeration = "";
 		Enumeration<?> bf = person.preorderEnumeration();
		while(bf.hasMoreElements()){ 
			preOrderEnumeration += bf.nextElement().toString()  + "\n";
		}
		
		return preOrderEnumeration;
	}
	
	
	public String printPostOrder() {
		String postOrderEnumeration = "";
 		Enumeration<?> bf = person.postorderEnumeration();
		while(bf.hasMoreElements()){ 
			postOrderEnumeration += bf.nextElement().toString() + "\n";
		}
		
		return postOrderEnumeration;
	}
	
}